using System.ComponentModel.DataAnnotations;

namespace Eno.Domain.Entity.Log;


public class Log
{
    [Key]
    public int Id { get; set; }

    [Required]
    [StringLength(50)]
    public string Level { get; set; } = string.Empty; // Info, Warning, Error, Debug

    [Required]
    [StringLength(500)]
    public string Message { get; set; } = string.Empty;

    public string? Exception { get; set; }

    [StringLength(100)]
    public string? Source { get; set; } // 日志来源（Controller、Service等）

    [StringLength(50)]
    public string? UserId { get; set; }

    [StringLength(100)]
    public string? UserName { get; set; }

    [StringLength(50)]
    public string? IpAddress { get; set; }

    [StringLength(500)]
    public string? RequestPath { get; set; }

    public DateTime CreatedAt { get; set; } = DateTime.Now;

    public string? AdditionalData { get; set; } // JSON格式的额外数据
}